<template>
	<div class="rightContent">
		<automaticAccess v-if="parseInt(isActiveValue) === 0"></automaticAccess>
		<warehouse v-else-if="parseInt(isActiveValue) === 1"></warehouse>
		<copyrightManage v-else-if="parseInt(isActiveValue) === 2"></copyrightManage>
		<copyrightAgency v-else-if="parseInt(isActiveValue) === 3"></copyrightAgency>

	</div>
</template>

<script>
	import automaticAccess from '../automaticAssess/automaticAccess'
	import warehouse from '../warehouse/warehouse'
	import copyrightManage from '../copyrightManage/copyrightManage'
	import copyrightAgency from '../copyrightAgency/copyrightAgency'
	export default {
		name: "RightContent",
		components: {
			automaticAccess,
			warehouse,
			copyrightManage,
			copyrightAgency
			
		},
		props:{
			//左侧菜单默认选中状态
			isActive:'',
		},
		data() {
			return {
				isActiveValue:'',
			};
		},
		methods: {
			switchContent(menuValue){
				console.log("nriton="+menuValue)
				switch (menuValue) {
					case 0:
						this.$router.push({  //核心语句
							path:'/copyRight/automaticAccess',   //跳转的路径
							query:{           //路由传参时push和query搭配使用 ，作用时传递参数
								activeStatus:menuValue ,  
							}
						})
						break;
					case 1:
						this.$router.push({  //核心语句
							path:'/copyRight/warehouse',   //跳转的路径
							query:{           //路由传参时push和query搭配使用 ，作用时传递参数
								activeStatus:menuValue ,  
							}
						})
						break;
					case 2:
						this.$router.push({  //核心语句
							path:'/copyRight/copyrightManage',   //跳转的路径
							query:{           //路由传参时push和query搭配使用 ，作用时传递参数
								activeStatus:menuValue ,  
							}
						})
						break;
					case 3:
						this.$router.push({  //核心语句
							path:'/copyRight/copyrightAgency',   //跳转的路径
							query:{           //路由传参时push和query搭配使用 ，作用时传递参数
								activeStatus:menuValue ,  
							}
						})
						break;
				}
			},
			
		},

		beforeMount: function() {
			// console.log("47")
		},
		mounted: function() {
			this.isActiveValue = this.isActive;
			console.log("this.isActiveValue="+this.isActiveValue);
			this.switchContent(this.isActiveValue);
		},
		watch:{
			// 路由监听
// 			$route(){
// 				this.isActiveValue = this.$route.query.activeStatus
// 				this.switchContent(this.isActiveValue);
// 			},
			isActive(val, oldVal){
				console.log("isActiveValue: "+val, oldVal);
				this.isActiveValue = val;
				this.switchContent(val);
			}
		}
	};
</script>

<style scoped="scoped">
	/* @import './rightContent.css' */
</style>
